package edu.umn.msse.farside.FourH.services;

import edu.umn.msse.farside.FourH.domain.Volunteer;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: Farside
 * Date: Feb 5, 2009
 * A security service for the system
 */
public interface VolunteerService
{
    /**
     * create a new user account in the system
     * @param user the user to add to the system as a volunteer
     * @throws edu.umn.msse.farside.FourH.exceptions.DuplicateVolunteerException
     */
    @Transactional
    public void addVolunteer(Volunteer user);

    /**
     * Retrieve a volunter account
     * @param id
     * @return a volunter account
     */
    public Volunteer getVolunteer(Long id);

    /**
     * find a volunter based on email.
     * @param email
     * @return
     */
    public Volunteer findVolunteer(String email);

    /**
     * delete a volunteer
     * @param email
     */
    @Transactional
    public void deleteVolunteer(String email);

    /**
     * Update the email address, password, first name, and last name of a user account
     * @param user the user account to be updated
     */
    @Transactional
    public void updateVolunteer(Volunteer user);

    /**
     * Validates a user account by email and password
     * @param email
     * @param password
     * @throws SecurityException
     */
    public boolean authenticate(String email, String password);

    /**
     * Reset the user's password to a randomly generated password
     * @param user
     * @return
     */
    @Transactional
    public void resetPassword(Volunteer user);
}
